<template>
  <div class="mod-report__reportdatedata">
    <el-form :inline="true" :model="state.dataForm" @keyup.enter="state.getDataList()">
      <el-form-item>
        <el-input v-model="state.dataForm.code" placeholder="渠道码" clearable></el-input>
      </el-form-item>
      <el-form-item>
        <el-button @click="state.getDataList()">{{ $t("query") }}</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="info" @click="state.exportHandle()">{{ $t("export") }}</el-button>
      </el-form-item>
    </el-form>
    <el-table v-loading="state.dataListLoading" :data="state.dataList" border @selection-change="state.dataListSelectionChangeHandle" style="width: 100%">
      <el-table-column prop="date" label="日期" header-align="center" align="center" width="120"></el-table-column>
      <el-table-column prop="code" label="渠道码" header-align="center" align="center"></el-table-column>
      <el-table-column prop="registerCount" label="注册人数" header-align="center" align="center"></el-table-column>
      <el-table-column prop="bountyAmount" label="赠送金额" header-align="center" align="center"></el-table-column>
      <el-table-column prop="firstBuyCount" label="首次买币人数" header-align="center" align="center" width="120"></el-table-column>
      <el-table-column prop="buyCount" label="买入人数" header-align="center" align="center"></el-table-column>
      <el-table-column prop="buyAmount" label="买入USDT" header-align="center" align="center"></el-table-column>
      <el-table-column prop="sellCount" label="卖出人数" header-align="center" align="center"></el-table-column>
      <el-table-column prop="sellAmount" label="卖出USDT" header-align="center" align="center"></el-table-column>
      <el-table-column prop="sellFbAmount" label="卖出INR" header-align="center" align="center"></el-table-column>
      <!--      <el-table-column prop="totalBalance" label="会员总余额" header-align="center" align="center"></el-table-column>
      <el-table-column prop="buySellSub" label="（买入-卖出）" header-align="center" align="center" width="120"></el-table-column>-->
      <el-table-column prop="dfFee" label="代付消耗USDT" header-align="center" align="center" width="120"></el-table-column>
<!--      <el-table-column label="代付费用" header-align="center" align="center">
        <template v-slot="scope">
          {{scope.row.dfFee - scope.row.sellAmount}}
        </template>
      </el-table-column>-->
      <el-table-column prop="earn" label="收益" header-align="center" align="center" width="120">
        <template #header>
          <el-tooltip class="box-item" effect="dark" content="收益 = 买入-代付消耗" placement="top-start">
            <div style="display: flex; justify-content: center; align-items: center">
              <span style="margin-right: 3px">收益</span> <el-icon><Warning /></el-icon>
            </div>
          </el-tooltip>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination :current-page="state.page" :page-sizes="[10, 20, 50, 100]" :page-size="state.limit" :total="state.total" layout="total, sizes, prev, pager, next, jumper" @size-change="state.pageSizeChangeHandle" @current-change="state.pageCurrentChangeHandle"> </el-pagination>
  </div>
</template>

<script lang="ts" setup>
import useView from "@/hooks/useView";
import { nextTick, reactive, ref, toRefs, watch } from "vue";

const view = reactive({
  getDataListURL: "/report/reportdatecodedata/page",
  getDataListIsPage: true,
  exportURL: "/report/reportdatecodedata/export",
  deleteURL: "/report/reportdatecodedata",
  deleteIsBatch: true,
  dataForm: {
    code: ""
  }
});

const state = reactive({ ...useView(view), ...toRefs(view) });
</script>
